package thread;

class MyTread extends Thread{
    @Override
    public void run() {
        while (true) {
            System.out.println(11);
            try {
                Thread.sleep(1000);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
        }
    }
}
class MyThread2 extends Thread{
    public void run(){
        while(true){
            System.out.println(22);
            try{
                Thread.sleep(1000);
            }catch (InterruptedException e){
                e.printStackTrace();
            }
        }
    }
}
public class Demo1 {
    public static void main(String[] args) {
        Thread thread=new MyTread();
        Thread thread2=new MyThread2();
        thread.start();
        thread2.start();
    }
}
